// Example of the closure usage.
def doCallWithTransaction(Closure closure) throws DataInTransactionException {
	def conn = dataSource.getConnection()
	conn.setAutoCommit(false)
	try {
		StoredProcedureDao dao = new StoredProcedureDao(conn)

		closure.call(dao)

		conn.commit()
	} catch(Exception e) {
		conn.rollback()
		throw new DataInTransactionException(e)
	} finally {
		conn.close()
	}
}

def callWithTransaction(String procName, List inputList) throws DataInTransactionException {
	doCallWithTransaction {dao ->
		inputList.each {
			dao.call(procName, it)
		}
	}
}